﻿Option Explicit On ' Make sure all items are explicitly declared
Option Strict On ' Be Very Strict about things here!
Namespace ZuneCardr
    ''' <summary>Badge</summary>
    ''' <author>Comentsys</author>
    ''' <version>1.0.0</version>
    ''' <created>1st February 2009</created>
    ''' <modified>1st February 2009</modified>
    ''' <remarks>Badge Data</remarks>
    Public Class Badge

        ' Private Constants

        Private Const VAL_BADGE_LARGE As String = "badgeImageLarge"
        Private Const VAL_BADGE_SMALL As String = "badgeImageSmall"

        ' Private Members

        Private strID As String
        Private strName As String
        Private strDesc As String
        Private strType As String
        Private strBadgeLarge As String
        Private imgBadgeLarge As New BitmapImage
        Private strBadgeSmall As String
        Private imgBadgeSmall As New BitmapImage
        Private _Artist As Artist
        Private blnSelected As Boolean = True

        ' Public Methods

        ''' <summary>Constructor</summary>
        ''' <param name="Element">Elements to Parse</param>
        Public Sub New(ByRef Element As XElement)
            Dim ImageDict As New Dictionary(Of String, String)
            strID = Element.<id>.Value
            strName = Element.<label>.Value
            strDesc = Element.<description>.Value
            strType = Element.<type>.Value
            ImageDict = Social.GetImages(Element.<image>.<url>)
            strBadgeSmall = ImageDict.Item(VAL_BADGE_SMALL)
            imgBadgeSmall = New BitmapImage(New Uri(strBadgeSmall))
            strBadgeLarge = ImageDict.Item(VAL_BADGE_LARGE)
            imgBadgeLarge = New BitmapImage(New Uri(strBadgeLarge))
            _Artist = New Artist(Element.<artist>)
            ImageDict = Nothing
        End Sub

        ' Public Properties

        ''' <summary>ID</summary>
        ''' <returns>Zune ID</returns>
        Public ReadOnly Property ID() As String
            Get
                Return strID
            End Get
        End Property

        ''' <summary>Name</summary>
        ''' <returns>Name Text</returns>
        Public ReadOnly Property Name() As String
            Get
                Return strName
            End Get
        End Property

        ''' <summary>Description</summary>
        ''' <returns>Description Text</returns>
        Public ReadOnly Property Description() As String
            Get
                Return strDesc
            End Get
        End Property

        ''' <summary>Type</summary>
        ''' <returns>Type Text</returns>
        Public ReadOnly Property Type() As String
            Get
                Return strType
            End Get
        End Property

        ''' <summary>ImageLarge</summary>
        ''' <returns>Large Badge Image</returns>
        Public ReadOnly Property ImageLarge() As BitmapImage
            Get
                Return imgBadgeLarge
            End Get
        End Property

        ''' <summary>ImageSmall</summary>
        ''' <returns>Small Badge Image</returns>
        Public ReadOnly Property ImageSmall() As BitmapImage
            Get
                Return imgBadgeSmall
            End Get
        End Property

        ''' <summary>Artist</summary>
        ''' <returns>Badge Artist</returns>
        Public ReadOnly Property Artist() As Artist
            Get
                Return _Artist
            End Get
        End Property

        ''' <summary>Selected</summary>
        ''' <returns>Selected Value</returns>
        ''' <remarks>Use on ZuneCard Value</remarks>
        Public Property Selected() As Boolean
            Get
                Return blnSelected
            End Get
            Set(ByVal Value As Boolean)
                blnSelected = Value
            End Set
        End Property

    End Class
End Namespace
